<!--

function Redirect(target,type){
    /* redirect to a new location OR pop up a new window
    * variable: target	-> redirect to
    * variable: type	-> location to a new URL OR pop up window OR other
    */

    target = "http://www.acuityworld.com/en/" + target;

    switch (type){
        case 1:
        window.parent.location = target;
        break;

        case 2:
        var HEIGHT = 500;
        var WIDTH = 700;
        window.open(target,"detail","height="+HEIGHT+",width="+WIDTH+",top=20,left=20,location=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,");
        break;

        case 3:
        var HEIGHT = 400;
        var WIDTH = 540;
        window.open(target,"edit","height="+HEIGHT+",width="+WIDTH+",top=200,left=200,location=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,");
        break;

        case 4:
        window.showModalDialog(target,"choose","Height: 200; Width: 275; help: no");
        break;

        case 5:
        var HEIGHT = 400;
        var WIDTH = 540;
        window.open(target,"edit","height="+HEIGHT+",width="+WIDTH+",top=200,left=200,location=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,");
        break;

        case 6:
        var HEIGHT = 400;
        var WIDTH = 540;
        window.open(target,"edit","height="+HEIGHT+",width="+WIDTH+",top=200,left=200,location=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,");
        break;

        default:
        break;
    }
}

function trim(s) {
    return s.replace(/(^\s*)|(\s*$)/g, "");
}

function isEmail(s) {
    var patrn=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

    if (!patrn.exec(s)) {
        return false;
    }
    return true;

}

function checkForm(form3) {  
	 if(typeof(form3.card_name)!='undefined')
	 {
		if (trim(form3.card_name.value) == "") {
			alert('Please enter Card holder\'name');
			form3.card_name.focus();
			return false;
		}
		if (trim(form3.card_number.value) == "") {
			alert('Please enter Card number');
			form3.card_number.focus();
			return false;
		}
	
	
		if (trim(form3.card_eyear.value) == "" || trim(form3.card_emonth.value) == "") {
			alert('Please enter Expiry Date');
			form3.card_eyear.focus();
			return false;
		}
	
		if (trim(form3.card_cvc.value) == "") {
			alert('Please enter Security Code');
			form3.card_cvc.focus();
			return false;
		}
	 }
    if (form3.faq1.checked==false) {
        alert('You must read and accepted Acuity World WebShop Terms of Sale and Delivery ');
        form3.faq1.focus();
        return false;
    }

    return true;
}

function checkRegForm(form2) {

//    if (trim(form2.username.value) == "") {
//        alert('Please enter username');
//        form2.username.focus();
//        return false;
//    }

    if (form2.password.value != form2.verify.value) {
        alert('Invalid password or verify');
        form2.password.focus();
        return false;
    }

    if (trim(form2.password.value) == "") {
        alert('Please enter password');
        form2.password.focus();
        return false;
    }

    if (!isEmail(form2.email.value)) {
        alert('You didn\'t specify a valid Email');
        form2.email.focus();
        return false;
    }
    if (trim(form2.company.value) == "") {
        alert('Please enter Company');
        form2.firstname.focus();
        return false;
    }
    if (trim(form2.firstname.value) == "") {
        alert('Please enter firstname');
        form2.firstname.focus();
        return false;
    }

    if (trim(form2.lastname.value) == "") {
        alert('Please enter lastname');
        form2.lastname.focus();
        return false;
    }




    if (trim(form2.street.value) == "") {
        alert('Please enter House no. / Street ');
        form2.street.focus();
        return false;
    }

    if (trim(form2.city.value) == "") {
        alert('Please enter City / Town');
        form2.city.focus();
        return false;
    }

    if (trim(form2.state.value) == "" && !(form2.country.value == "Denmark" || form2.country.value == "Sweden" || form2.country.value == "Norway")) {
        alert('Please enter State / Province ');
        form2.state.focus();
        return false;
    }

    if (trim(form2.zip.value) == "") {
        alert('Please enter ZIP / Postal Code');
        form2.zip.focus();
        return false;
    }

    if (trim(form2.country.value) == "") {
        alert('Please enter Country / Region');
        form2.country.focus();
        return false;
    }
    
    if (trim(form2.phone1.value) == "") {
        alert('Please enter phone');
        form2.phone1.focus();
        return false;
    }

    if (trim(form2.phone.value) == "") {
        alert('Please enter phone');
        form2.phone.focus();
        return false;
    }
    
    if (trim(form2.street2.value) == "") {
        alert('Please enter House no. / Street ');
        form2.street2.focus();
        return false;
    }

    if (trim(form2.city2.value) == "") {
        alert('Please enter City / Town');
        form2.city2.focus();
        return false;
    }

    if (trim(form2.state2.value) == "" && !(form2.country2.value == "Denmark" || form2.country2.value == "Sweden" || form2.country2.value == "Norway")) {
        alert('Please enter State / Province ');
        form2.state2.focus();
        return false;
    }

    if (trim(form2.zip2.value) == "") {
        alert('Please enter ZIP / Postal Code');
        form2.zip2.focus();
        return false;
    }

    if (trim(form2.country2.value) == "") {
        alert('Please enter Country / Region');
        form2.country2.focus();
        return false;
    }
    
    

    if (document.form2.faq1.checked==false) {
        alert('You must read and accepted Acuity World WebShop Terms of Sale and Delivery ');
        form2.faq1.focus();
        return false;
    }

    return true;

}


function checkRegForm2(form2) {

    if (trim(form2.username.value) == "") {
        alert('Please enter username');
        form2.username.focus();
        return false;
    }

    if (form2.password.value != form2.verify.value) {
        alert('Invalid password or verify');
        form2.password.focus();
        return false;
    }

    if (trim(form2.password.value) == "") {
        alert('Please enter password');
        form2.password.focus();
        return false;
    }

    if (!isEmail(form2.email.value)) {
        alert('You didn\'t specify a valid Email');
        form2.email.focus();
        return false;
    }

    if (trim(form2.firstname.value) == "") {
        alert('Please enter firstname');
        form2.firstname.focus();
        return false;
    }

    if (trim(form2.lastname.value) == "") {
        alert('Please enter lastname');
        form2.lastname.focus();
        return false;
    }




    if (trim(form2.street.value) == "") {
        alert('Please enter House no. / Street ');
        form2.street.focus();
        return false;
    }

    if (trim(form2.city.value) == "") {
        alert('Please enter City / Town');
        form2.city.focus();
        return false;
    }

    if (trim(form2.state.value) == "") {
        alert('Please enter State / Province ');
        form2.state.focus();
        return false;
    }

    if (trim(form2.zip.value) == "") {
        alert('Please enter ZIP / Postal Code');
        form2.zip.focus();
        return false;
    }

    if (trim(form2.country.value) == "") {
        alert('Please enter Country / Region');
        form2.country.focus();
        return false;
    }


    if (trim(form2.phone1.value) == "") {
        alert('Please enter phone');
        form2.phone1.focus();
        return false;
    }

    if (trim(form2.phone.value) == "") {
        alert('Please enter phone');
        form2.phone.focus();
        return false;
    }

    if (document.form2.faq1.checked==false) {
        alert('You must read and accepted Acuity World WebShop Terms of Sale and Delivery ');
        form2.faq1.focus();
        return false;
    }

    return true;

}

function checkPromoterUpdateForm(theform) {

    if (trim(theform.firstname.value)=="") {
        theform.firstname.focus();
        alert("You didn't specify a valid First Name");
        return false;
    }

    if (trim(theform.lastname.value)=="") {
        theform.lastname.focus();
        alert("You didn't specify a valid Last Name");
        return false;
    }

    if (trim(theform.phone1.value)=="") {
        theform.phone1.focus();
        alert("You didn't specify a valid Phone");
        return false;
    }

    if (trim(theform.phone.value)=="") {
        theform.phone.focus();
        alert("You didn't specify a valid Phone");
        return false;
    }

    if (!isEmail(theform.email.value)){
        theform.email.focus();
        alert("You didn't specify a valid Email");
        return false;
    }

}

function checkMFPForm(theform) {

    if (!isEmail(theform.email.value)){
        theform.email.focus();
        alert("You didn't specify a valid Email");
        return false;
    }

}

function checkPFPForm(theform) {

    if (trim(theform.pid.value)=="") {
        theform.pid.focus();
        alert("You didn't specify a valid Promoter's ID");
        return false;
    }

    if (!isEmail(theform.email.value)){
        theform.email.focus();
        alert("You didn't specify a valid Email");
        return false;
    }

}

function loginform(form1) {

}
function procee2checkout(num)
{
	if(num<=0)
	{
		alert('The shopping cart is empty!');
		return false;
	}
	else
	{
		location.href='member_signup.php';
	}
}
function procee2checkout_p(num)
{
	if(num<=0)
	{
		alert('The shopping cart is empty!');
		return false;
	}
	else
	{
		location.href='shopping_cart_p.php?checkout';
	}
}
function genHTMLcode(picUrl,width,height,promoterId,lang)
{	
	var fileType = picUrl.substr(picUrl.indexOf('.')+1);
	var fileName = picUrl.substr(0,picUrl.length-fileType.length-1);
	if(lang!='')
		lang = lang + "/";
	var domain="http://webshop.acuityworld.com/"+lang;
	var downText = document.getElementById("downText");
	downText.innerHTML = "";
	downText.style.display = "none";
	var rtn = "";
	if(fileType == "jpg" || fileType == "jpeg" || fileType == "gif")
	{
		 rtn="<a href='"+domain+"setPromoterId.php?pid="+promoterId+"' target='_blank'><img src='http://webshop.acuityworld.com/pictures/promotion/"+picUrl+"' alt='promotion banner' width='"+width+"' height='"+height+"' border='0'/></a>";
	}
	else if(fileType == "swf" || fileType == "flv")
	{
rtn = "<div style=\"position:relative;width:"+width+"px;height:"+height+"px;\"><EMBED style=\"position:absolute;z-index:0\" src=\""+picUrl+"\" quality=\"high\" width=\""+width+"\" height=\""+height+"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" wmode=\"opaque\"><a href=\""+domain+"setPromoterId.php?pid="+promoterId+"\" target=\"_blank\" style=\"cursor:pointer\"><div style=\"position:relative;filter:alpha(opacity=0);-moz-opacity:0;left:0;top:0; background:#CDEAF6;width:"+width+"px;height:"+height+"px;z-index:10\"></div></a></div>";		
		
	downText.innerHTML = "<a href=\"getfile.php?url=pictures/promotion/"+picUrl+"\" target=\"_blank\">You need to click here to download the flash you select to upload onto your website !</a>";
	downText.style.display="";
	}
	else
	{
		rtn = "Unknown file type!";	
	}
	var txt = document.getElementById("txtHtmlCode");
	txt.value=rtn;
	txt.focus();
	txt.select();
}
function copyHtml()
{
	var txtHtmlCode=document.getElementById("txtHtmlCode");
	if(txtHtmlCode.value.length==0)
	{
		alert('Please select a banner');
		return ;
	}
	
	copyToClipboard(txtHtmlCode.value)	
}
function copyToClipboard(copy) {
    if (window.clipboardData){
	window.clipboardData.setData("Text", copy);}
	else if (window.netscape){
	netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
	var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
	if (!clip) return;
	var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
	if (!trans) return;
	trans.addDataFlavor('text/unicode');
	var str = new Object();
	var len = new Object();
	var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
	var copytext=copy;
	str.data=copytext;
	trans.setTransferData("text/unicode",str,copytext.length*2);
	var clipid=Components.interfaces.nsIClipboard;
	if (!clip) return false;
	clip.setData(trans,null,clipid.kGlobalClipboard);}
	return false;

}
function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
      scroll_div.scrollLeft-=scroll_begin.offsetWidth
    else
      scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
//*****Tab bar used in  promoter banner page
function initTab(preTab,preTabContent,ShowTab,TabNum)
{
	var x = document.getElementById(preTab + ShowTab); 	
	x.className = "Selected";
	for(var i=1;i<=TabNum;i++){
        var c = document.getElementById(preTabContent + i); 
		if(i == ShowTab)
		{
			c.style.display="";	
		}
		else
		{
			c.style.display="none";
		}
    }    
}
function switchTab(preTab,preTabContent,ShowTab,TabNum){   
    for(var i=1;i<=TabNum;i++){
        var x = document.getElementById(preTab + i); 
		if(i == ShowTab)
		{
			document.getElementById(preTabContent+i).style.display="";	
		}
		else
		{
			document.getElementById(preTabContent+i).style.display="none";
		}
        x.className = "mousehand";
		x.style.cursor = "hand";
    }    
    document.getElementById(preTab + ShowTab).className = "Selected";
}
//*****Tab bar used in  promoter banner page

//->